package com.jia.leetCode;

public class Pro1464 {
    public int maxProduct(int[] nums) {
        if(nums.length < 2) return -1;
        int max = -1;
        int pre = -1;
        for(int i = 0; i < nums.length; i++) {
            if(nums[i] >= max) {
                pre = max;
                max = nums[i];
            }else if(nums[i] > pre) {
                pre = nums[i];
            }
        }
        return (pre - 1) * (max - 1);
    }
}

